In [ ]:
%pylab
%matplotlib inline
import pandas as pd
from pandas import DataFrame, Series

import json
import seaborn as sns
import scipy

import IPython
from IPython.display import Image, display

pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.mpl_style', 'default') # Make the graphs a bit prettier

sns.set_style("darkgrid")
sns.set_palette("bright")

plt.rcParams['figure.figsize'] = (13, 9)
plt.rcParams['font.family'] = 'sans-serif'

import statsmodels.api as sm
import statsmodels.stats.api as sms
import statsmodels.formula.api as smf

Spider Anxiety


In [ ]:
spiderdata = pd.read_table('../../DSUR/09/SpiderLong.dat')
spiderdata.head(10)

In [ ]:
spiderdata.describe()

In [ ]:
spiderdata.groupby("Group").describe()

In [ ]:
sns.barplot(data=spiderdata, x="Group", y="Anxiety", ci=68)

Independent t-Test


In [ ]:
model = smf.ols('Anxiety ~ Group', spiderdata).fit()
model.summary()

In [ ]:
p = spiderdata[spiderdata.Group=="Picture"]
r = spiderdata[spiderdata.Group=="Real Spider"]
scipy.stats.ttest_ind(p.Anxiety, r.Anxiety)

In [ ]:
sns.pointplot(data=spiderdata, x="Group", y="Anxiety", ci=95)

Dependent t-Test


In [ ]:
spiderdata = pd.read_table('../../DSUR/09/SpiderWide.dat')
spiderdata.head(10)

In [ ]:
spiderdata["diff"] = spiderdata.real - spiderdata.picture
spiderdata.head(10)

In [ ]:
spiderdata.describe()

In [ ]:
scipy.stats.ttest_rel(spiderdata.picture, spiderdata.real)

In [ ]: